<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>优惠管理</title>
</head>
<body>
    <div id="discounts_toolbar" class="search-div" style="margin: 10px 10px 40px">
        <!-- 查询条件区域 -->
        <div class="search-content">
            <span>
                <label>标题：</label>
                <input type="text" name="rulesTitle"  class="span2" />
                &nbsp;<i class="boot_icon-question-sign" selectLike="tooltip"></i>
            </span>
            <span>
                <label>类型：</label>
                <select name="rulesTypeid" style="width: 110px;">
                    <option value="">==请选择==</option>
                </select>
            </span>
        </div>
        <!-- 功能区域 -->
        <div class="search-toolbar" >
            <span style="float:left;">
                <a class="easyui-linkbutton clearDgChecked"  icon="icon-redo"	plain="true"  title="清空所有勾选项" >清空勾选</a>
                <a  class="easyui-linkbutton"  icon="icon-add"	plain="true" title="添加优惠活动"  id="discounts_add" ><span>添加优惠活动 </span></a>
                <a class="easyui-linkbutton"  icon="icon-edit"	plain="true" title="修改优惠活动"  id="discounts_update" ><span>修改优惠活动</span></a>
                <a class="easyui-linkbutton"  icon="icon-remove"	plain="true" title="确定要删除吗?" id="discounts_delete"><span>批量删除</span></a>
            </span>
            <span style="float:right">
                <button class="btn btn-primary btn-small" type="submit">查询</button>&nbsp;
                <button class="btn btn-small clear" type="button" >清空</button>&nbsp;
            </span>
        </div>
    </div>
    <!--注意，每个页面的id不要一样-->
    <table id="discounts_dg"></table>
    <!--增加弹窗-->
    <div id="discounts_add_dialog"></div>
    <!--修改弹窗-->
    <div id="discounts_update_dialog"></div>
    <!--删除弹窗-->
    <div id="discounts_delete_dialog"></div>
    <script>
        $(function () {

            //数据查询
            $('#discounts_dg').datagrid({
                url:'testJson/discounts_json.json',
                frozenColumns:[[
                    {
                        field:"id",
                        title : "勾选",
                        checkbox:true
                    }
                ]],
                columns:[[
                    {field:'code',title:'编号',width:100},
                    {field:'companyName',title:'公司/商家名称',width:100},
                    {field:'name',title:'发布者姓名',width:100},
                    {field:'activityName',title:'活动名称',width:100},
                    {field:'startingtime',title:'起始时间',width:100},
                    {field:'deadline',title:'截止时间',width:100},
                    {field:'state',title:'状态',width:100,align:'right'},
                    // {
                    //     field : "delete",
                    //     title : "操作",
                    //     align:"center",
                    //     width : 100,
                    //     formatter: function(value,row,index){
                    //         return '<a  href="#">删除</a>';
                    //     }
                    // } ,
                ]]
            });
           //增加数据
            $("#discounts_add").on("click",function () {
                $('#discounts_add_dialog').dialog({
                    title: '增加优惠活动数据',
                    width: 600,
                    height: 400,
                    closed: false,
                    cache: false,
                    href: 'page/discounts/discounts_add.html',
                    modal: true
                });

            });

            $("#discounts_update").on("click",function () {
                $("#discounts_update_dialog") .dialog({
                    title:'修改优惠活动数据',
                    width:600,
                    height:400,
                    closed: false,
                    cache:false,
                    href:'page/discounts/discounts_update.html',
                    modal:true,
                })
            })
            $("#discounts_delete").on("click",function () {
                $("#discounts_delete_dialog") .dialog({
                    title:'删除优惠活动数据',
                    width:600,
                    height:400,
                    closed: false,
                    cache:false,
                    href:'page/discounts/discounts_delete.html',
                    modal:true,
                })
            })

        });

    </script>

</body>
</html>